package com.demo.blog;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

public class UserController extends Controller{
	
	public void queryUserList() {
		String sql = "select * from login";
//		setAttr("data", Db.find(sql));
		List<Record> list = Db.find(sql);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("createTime", null);
		map.put("createBy", null);
		map.put("updateTime", null);
		map.put("updateBy", null);
		map.put("remark", null);
		map.put("code", 0);
		map.put("msg", null);
		map.put("count", list.size());
		map.put("data", list);
		renderJson(map);
	}
	
	
	public void delectId() {
		String id = getPara("id");
		String sql = "delete from login where id = ?";
		int update = Db.update(sql,Integer.valueOf(id));
		renderJson(update);

	}
	
	
}
